package net.starwifi.duobao.web.shop;

import net.starwifi.duobao.entity.Product;
import net.starwifi.duobao.mvc.BaseController;
import net.starwifi.duobao.service.MemberService;
import net.starwifi.duobao.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created by Administrator on 2015/11/9.
 */
@Controller("shopProductController")
@RequestMapping(value = "/shop")
public class ProductController extends BaseController {

    @Autowired
    MemberService memberService;

    @Autowired
    ProductService productService;

    /**
     * 商品详情页
     */
    @RequestMapping(value = "/product-{id}", method = RequestMethod.GET)
    public String product(Model model,@PathVariable Long id) {
        Product product=productService.find(id);
        model.addAttribute("product",product);
        return "/shop/product";
    }

}
